package com.self.admin.controller;

import com.self.admin.service.SysUserService;
import com.self.admin.vo.LoginResultVo;
import com.self.common.response.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version v1.0
 * @ClassName: LoginController
 * @Description:
 * @Author: Mac
 * @Date: 2022/6/2 22:08
 */

@Api(tags = "登陆控制器")
@Slf4j
@RestController
//@RequestMapping("/api")
public class LoginController {

    @Autowired
    private SysUserService sysUserService;

    @PostMapping("/login")
    @ApiOperation("前后台登陆")
    public R<LoginResultVo> login(@RequestParam("username") String username,
                                  @RequestParam("password") String password){
       log.debug("前后台登陆参数，用户名:{}",username);
       LoginResultVo resultVo = sysUserService.login(username,password);
       return R.ok(resultVo);
    }
}
